package org.example.springcloud.controller;

import org.example.springcloud.service.AccountService;
import org.example.springcloud.utils.ResultVOUtil;
import org.example.springcloud.vo.ResultVO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @Description:
 * @Author: y
 * @CreateDate: 8/2/21 9:41 AM
 * @Version: 1.0
 */
@RestController
public class AccountController {

    @Resource
    AccountService accountService;

    /**
     * 扣减账户余额
     */
    @RequestMapping("/account/decrease")
    public ResultVO decrease(@RequestParam("userId") Long userId, @RequestParam("money") BigDecimal money) {
        accountService.decrease(userId, money);
        return ResultVOUtil.success(200, "扣减账户余额成功！");
    }

}



